/*
 * CCameraDevice.h
 *
 *  Created on: 2018年10月4日
 *      Author: zhengboyuan
 */

#ifndef CCAMERADEVICE_H_
#define CCAMERADEVICE_H_

#include "CameraDevice.h"

#undef ZOOM_IN
#undef ZOOM_OUT

#include "HCNetSDK.h"


class CCameraDevice : public CameraDevice
{
public:
    CCameraDevice();
    virtual ~CCameraDevice();

	virtual bool open(const Camera& camera);
	virtual void close();
	virtual bool isConnected();
	virtual bool reconnect();

	virtual void setConnected(bool connected);

	LONG getLoginUser();

	

protected:
	static BOOL CALLBACK MSGCallBack_V31(LONG lCommand, NET_DVR_ALARMER *pAlarmer, char *pAlarmInfo, DWORD dwBufLen, void* pUser);
	static void CALLBACK ExceptionCallBack(DWORD dwType, LONG lUserID, LONG lHandle, void *pUser);

	static void CALLBACK MSGCallBack(LONG lCommand,  NET_DVR_ALARMER *pAlarmer,
			char *pAlarmInfo, DWORD dwBufLen, void *pUser);

protected:
	bool login(const std::string& ip, int port, const std::string& user, const std::string& password);
	void logout();

	void setupAlarm();

	void msgCallback(LONG lCommand, NET_DVR_ALARMER *pAlarmer, char *pAlarmInfo, DWORD dwBufLen);

	void exceptionCallBack(DWORD dwType, LONG lUserID, LONG lHandle);

protected:
	LONG	m_user;
	NET_DVR_DEVICEINFO_V40	m_deviceInfo;
	LONG	m_alarmHandle;
	bool	m_connected;

};

#endif /* CCAMERADEVICE_H_ */
